package course_platform;

import java.util.ArrayList;
import java.util.List;

public class Teacher {
    private String id; // 教师编号
    private String name; // 教师姓名
    private String gender; // 性别
    private List<Course> courses; // 所授课程列表

    public Teacher(String id, String name, String gender) {
        this.id = id;
        this.name = name;
        this.gender = gender;
        this.courses = new ArrayList<>();
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getGender() {
        return gender;
    }

    public List<Course> getCourses() {
        return courses;
    }

    public void addCourse(Course course) {
        if (!courses.contains(course)) {
            courses.add(course);
            course.addTeacher(this);
        }
    }
}